describe("MoveTransactionDetailsController controller", function(){

    var controller = null;

    beforeEach(function(){

        var t_alertCtrl = App.AlertController.create();
        var t_loadingCtrl = App.LoadingController.create();
        App.MoveTransactionDetailsController.reopen({

            init:function(){
                this.set('controllers.alert', t_alertCtrl);
                this.set('controllers.loading', t_loadingCtrl);
            }

        });
        controller = App.MoveTransactionDetailsController.create();
    });

    describe("prepareController",function(){

        it("should show transaction details", function(){

            var transaction = App.PaymentTransaction.create();
            spyOn(App.Router,'getParameter').andReturn(transaction);
            spyOn(controller, 'set');

            spyOn(App.api_paymentHistoryDetail, 'getPaymentHistoryDetails').andCallFake(function(transaction,callback){
                callback();
            });

            controller.prepareController();

            expect(App.Router.getParameter).toHaveBeenCalled();
            expect(controller.set).toHaveBeenCalled();

            expect(App.api_paymentHistoryDetail.getPaymentHistoryDetails).toHaveBeenCalled();
        });
    });

    describe("paymentHistoryDetailsCallback", function(){

        it('return payment details', function() {

            var objE = {errorCode:'code', errorMessage:'message'};

            spyOn(controller, 'hasError').andReturn(false);
            spyOn(controller, 'hideLoading');

            controller.callback({}, objE);

            expect(controller.hasError).toHaveBeenCalled();
            expect(controller.hideLoading).toHaveBeenCalled();
        });
    });


});

